package Gui;

import java.io.File;

import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.StyledDocument;
import javax.swing.text.StyledEditorKit;

public class MyTextPane extends JTextPane {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private FileModel model;

	private StyledEditorKit editorkit;
	
	public MyTextPane(){
		super();
		//model = new FileModel();
	}
	
	private void writeModel(){
		
	}
	
	public void saveDocumentAs(File file){
		//wat moet ik hier saven?		
		try{
			Document doc = getDocument();
			System.out.println(doc.getText(0, doc.getLength()));
		}catch (BadLocationException ble) {
		    ble.printStackTrace();
		}
		
		/*
		 * RTFEditorKit rtfkit = new RTFEditorKit();
			StyledDocument doc = (StyledDocument) pane.getDocument();
			try {
			    FileOutputStream fwi = new FileOutputStream(outfile);
			    rtfkit.write(fwi, doc, 0, doc.getEndPosition().getOffset());
			    fwi.close();
			} catch (IOException ioe) {
			    ioe.printStackTrace();
			} catch (BadLocationException ble) {
			    ble.printStackTrace();
			}
			}
		 */
	}

}
